package com.feishi.project.elasticsearch.service;

import com.feishi.project.elasticsearch.bean.AccountInfo;
import com.feishi.project.elasticsearch.repository.ElasticAccountInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * @version 1.0
 * @auth caixq
 * @time 18-4-11 10:08
 **/
@Service("esAccountInfoServiceImpl")
public class ESAccountInfoServiceImpl implements ESAccountInfoService {

    @Autowired
    @Qualifier("elasticAccountInfoRepository")
    private ElasticAccountInfoRepository elasticAccountInfoRepository;

    public AccountInfo queryAccountInfoById(String id) {

        return elasticAccountInfoRepository.findById(id).get();
    }

    @Override
    public AccountInfo queryAccountInfoByName(String accountName) {
        return elasticAccountInfoRepository.findByAccountName(accountName);
    }
}
